There are 5 properties of an algorithm.
Input. There are more quantities that are extremely supplied.
Output. At least one quantity is produced.
Definiteness. Each instruction of the algorithm should be clear and unambiguous.
Finiteness. The process should be terminated after a finite number of steps.
Effectiveness.
Analysis of Algorithms:-
Why performance analysis?
There are many important things that should be taken care of, like user friendliness, modularity, security, maintainability, etc. Why to worry about performance?
The answer to this is simple, we can have all the above things only if we have performance. So performance is like currency through which we can buy all the above things.
We can have three cases to analyze an algorithm:
1) The Worst Case
In the worst-case analysis, we calculate the upper bound on the running time of an algorithm.
We must know the case that causes a maximum number of operations to be executed.
2) Average Case
In average case analysis, we take all possible inputs and calculate computing time for all of the inputs.
all the calculated values and divide the sum by the total number of inputs.
We must know (or predict) the distribution of cases.
3) Best Case
In the best case analysis, we calculate the lower bound on the running time of an algorithm.
We must know the case that causes a minimum number of operations to be executed.
Space Complexity:
The term Space Complexity is misused for Auxiliary Space at many places.
Following are the correct definitions of Auxiliary Space and Space Complexity.
Auxiliary Space is the extra space or temporary space used by an algorithm.
Space Complexity of an algorithm is the total space taken by the algorithm with respect to the input size.
Space complexity includes both Auxiliary space and space used by input.